package oss

import (
	"github.com/aliyun/aliyun-oss-go-sdk/oss"
	common "jihe.common"
	"sync"
)

var ossClietnOnce sync.Once
var ossClient *oss.Client

func GetClient() *oss.Client {
	ossClietnOnce.Do(func() {
		config := new(common.Config).Get()
		var err error
		ossClient, err = oss.New(config.Oss.Endpoint, config.Oss.AccessKeyId, config.Oss.AccessKeySecret)
		if err != nil {
			panic(err)
		}
	})
	return ossClient
}
